Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed RPM SPEC file Changelog not being read issue #236

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jyo64
Copy link

@jyo64 jyo64 commented Nov 27, 2024

The Date from build was not getting recorded properly in the SPEC file for RPM packaging due to the change log not being read and formatted properly. I have now fixed it. This solves #235.

@jyo64 jyo64 changed the title Enabled Proprer Changelog Syntax for RPM SPEC file Fixed RPM SPEC file Changelog not being read issue Nov 27, 2024
@@ -105,6 +105,10 @@ class MakeRPMConfig extends MakeConfig {

@override
Map<String, dynamic> toJson() {
final currentDate = DateTime.now();
DateTime now = DateTime.now();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly unnecessary duplicate variable? You could just use currentDate

Copy link

@MarkieMark MarkieMark Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(or now even simpler :-) )

As for the cp error, it seems it just needs the ../ relative path adding to the cp commands; so that ll131-143 would read

'%install': [
            'mkdir -p %{buildroot}%{_bindir}',
            'mkdir -p %{buildroot}%{_datadir}/%{name}',
            'mkdir -p %{buildroot}%{_datadir}/applications',
            'mkdir -p %{buildroot}%{_datadir}/metainfo',
            'mkdir -p %{buildroot}%{_datadir}/pixmaps',
            'cp -r ../%{name}/* %{buildroot}%{_datadir}/%{name}',
            'ln -s %{_datadir}/%{name}/%{name} %{buildroot}%{_bindir}/%{name}',
            'cp -r ../%{name}.desktop %{buildroot}%{_datadir}/applications',
            'cp -r ../%{name}.png %{buildroot}%{_datadir}/pixmaps',
            'cp -r ../%{name}*.xml %{buildroot}%{_datadir}/metainfo || :',
            'update-mime-database %{_datadir}/mime &> /dev/null || :',
            '%undefine __brp_add_determinism',
          ].join('\n'),

(including the %undefine that hangs); maybe you could please test whether that is a complete resolution of the regression for you as it seems it is for me?

@MarkieMark
Copy link

Well done for spotting the cause of the error, it had been throwing warnings for a while; now that I upgraded to F41 it's a solid error.

One question please, how to modify the behavior of flutter_distributor while waiting for the PR to merge?
I tried

$ dart pub global deactivate flutter_distributor
$ dart pub global activate --source path </path/to/modified/git/clone/of/flutter_distributor>
$ flutter_distributor release --name=dev --jobs=release-dev-linux-rpm

(config at linux/packaging/rpm/make_config.yaml all as working before)
as well as adding a

changelog: SomeEntryHere

to the make_config.yaml, yet no difference? Even putting some debugging print() statements into the packages/flutter_app_packager/lib/src/makers/rpm/make_rpm_config.dart file it looks as though the modified code is not being called / run? Is there some more config, is dart automatically retrieving the unmodified github or pub.dev code or package?

@jyo64
Copy link
Author

jyo64 commented Dec 8, 2024

Hi @MarkieMark

Thanks for reviewing the code. I have now removed the duplicate variable you mentioned. Unfortunately my env is not currently setup and I'm busy with some academic stuff. Maybe you could test it and let me know if some changes are needed?

The way I tested is with the following steps:

First run

dart pub global activate flutter_distributor

This will pull the flutter_distributor from the Original Git Repo

Then I copy and paste the required modification in the global flutter packages directory

And activate it again. Unfortunately I forgot the exact comment. One of those pulls the code from Github main again and overwrites and other reactivates the flutter package with the current modifications.

I think its

dart pub global activate flutter_distributor

But I'm not sure.

Sorry my answer is vague.

@jyo64
Copy link
Author

jyo64 commented Dec 8, 2024

Unfortunately this still did not work for me due to some other issue with the copy command in the rpm packaging and I had to end up building the RPM manually.

@MarkieMark
Copy link

MarkieMark commented Dec 8, 2024

The dart pub global activate flutter_distributor seems to download ready-compiled snapshots, that aren't easily edited; I've mostly got it now though,

$ dart run /path/to/github/clone/flutter_distributor/packages/flutter_distributor/bin/main.dart release --name=dev --jobs=release-dev-linux-rpm

while adding a relative path in packages/flutter_distributor/pubspec.yaml to

flutter_app_packager:
    path: ../flutter_app_packager

basically works (may need pub get in the various directories of the modified github clone) as far as seeming to parse / use changelog properly; however then it errors at the stage of copying files similarly to what you're seeing; it must be a breaking change in rpmbuild or similar

+ cp -r '<projectname>/*' /path/to/projectname/dist/<versionBuild>/<projectname>-<versionBuild>-linux_rpm/rpmbuild/BUILD/<projectname>-<versionBuild>-build/BUILDROOT/usr/share/<projectname>
cp: cannot stat '<projectname>/*': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.AU90fQ (%install)
    Bad exit status from /var/tmp/rpm-tmp.AU90fQ (%install)

@MarkieMark
Copy link

MarkieMark commented Dec 8, 2024

alright that particular error I added a cd command to the .spec file that was left behind in the incomplete build, so now from

cp -r %{name}/* %{buildroot}%{_datadir}/%{name}
ln -s %{_datadir}/%{name}/%{name} %{buildroot}%{_bindir}/%{name}
cp -r %{name}.desktop %{buildroot}%{_datadir}/applications
cp -r %{name}.png %{buildroot}%{_datadir}/pixmaps
cp -r %{name}*.xml %{buildroot}%{_datadir}/metainfo || :
update-mime-database %{_datadir}/mime &> /dev/null || :

it's

cd /path/to/flutter/project/dist/<versionBuild>/<appname>-<versionBuild>-linux_rpm/rpmbuild/BUILD
cp -r %{name}/* %{buildroot}%{_datadir}/%{name}
ln -s %{_datadir}/%{name}/%{name} %{buildroot}%{_bindir}/%{name}
cp -r %{name}.desktop %{buildroot}%{_datadir}/applications
cp -r %{name}.png %{buildroot}%{_datadir}/pixmaps
cp -r %{name}*.xml %{buildroot}%{_datadir}/metainfo || :
update-mime-database %{_datadir}/mime &> /dev/null || :
cd %{_builddir}
%undefine __brp_add_determinism

the %undefine to address the fact that it would hang at

+ update-mime-database /usr/share/mime
+ :
+ cd /tmp/electron-28616dLglJpPSbHl4/scratch-desktop_1.2.1_x86_64/BUILD/<appname>-<versionBuild>-build
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-ldconfig
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip /usr/bin/strip
+ /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/redhat/brp-strip-lto /usr/bin/strip
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/check-rpaths
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
+ /usr/lib/rpm/brp-remove-la-files
+ env /usr/lib/rpm/redhat/brp-python-bytecompile '' 1 0 -j8
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/bin/add-determinism --brp -j8 /tmp/electron-28616dLglJpPSbHl4/scratch-desktop_1.2.1_x86_64/BUILD/<appname>-<versionBuild>-build/BUILDROOT

it then leaves the .rpm in a temp folder such as /tmp/electron-28616dLglJpPSbHl4/scratch-desktop_1.2.1_x86_64/RPMS/x86_64/<appname>-<buildVersion>-<build>.fc41.x86_64.rpm

@jyo64
Copy link
Author

jyo64 commented Dec 9, 2024

@MarkieMark

Happy to know you got it working 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants